/***************************************************************************\
 * Copyright (C) by Keio University
 * IO.hpp created in 10 2011.
 * Mail : fdesorbi@hvrl.ics.keio.ac.jp
 *
 * IO.hpp is part of the HVRL Engine Library.
 *
 * The HVRL Engine Library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * The HVRL Engine Library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
\***************************************************************************/

#ifndef COMMON__IO_HPP__
#define COMMON__IO_HPP__

#include <sstream>
#include <iomanip>

namespace hvrl
{

template <typename T>
static inline std::string numberToString(const T & value)
{
    std::ostringstream os;
    os << value;
    return os.str();
}

static inline std::string stringEnumerator(const std::string &filename,
        const unsigned int number,
        const unsigned int digitCard,
        const std::string extension = "")
{
    std::ostringstream oss;
    oss << filename;
    oss << std::setfill('0') << std::setw(digitCard) << number ;
    oss << extension;

    return oss.str();
}


}

#endif
